using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class gamestate : MonoBehaviour
{
    // Start is called before the first frame update
    bool gameend;
    void Start()
    {
        gameend = false;
    }

    // Update is called once per frame
    void Update()
    {
        if (gameend) return;
        if (GameObject.FindWithTag("GrindingTower") == null && GameObject.FindWithTag("Enemy")==null)
        {
            GameRoot.Instance.scenesystem.scenestate.panelmanager.Push(new WinPanel());
            Time.timeScale = 0f;
            gameend = true;
            //TestGameRoot.Instance.scenesystem.scenestate.panelmanager.Push(new WinPanel());
        }
        if (GameObject.FindWithTag("Player") == null)
        {
            GameRoot.Instance.scenesystem.scenestate.panelmanager.Push(new LossPanel());
            Time.timeScale = 0f;
            gameend = true;
            //TestGameRoot.Instance.scenesystem.scenestate.panelmanager.Push(new LossPanel());
        }
    }
}
